/*********************\
* Author:Dzlua
* QQ:505544956
* Time:2017/04/15
\**********************/
#include "LuaGifAnim.h"

#define CObjPtr ((CGifAnimUI*)m_cobj)

namespace DuiLib {

void LuaGifAnim::SetVisible(bool bVisible)
{
    CObjPtr->SetVisible(bVisible);
}

int	LuaGifAnim::SetBkImage(LuaState *L)
{
    LuaStack args(L);
    SDTString str = LuaHelperNS::GetTString(args[2]);
    CObjPtr->SetBkImage(str.c_str());
    return 0;
}

int LuaGifAnim::GetBkImage(LuaState *L)
{
    SDTString str = CObjPtr->GetBkImage();
    LuaHelperNS::PushTString(L, str);
    return 1;
}

void LuaGifAnim::SetAutoPlay(bool bIsAuto)
{
    CObjPtr->SetAutoPlay(bIsAuto);
}

bool LuaGifAnim::IsAutoPlay()
{
    return CObjPtr->IsAutoPlay();
}

void LuaGifAnim::SetAutoSize(bool bIsAuto)
{
    CObjPtr->SetAutoSize(bIsAuto);
}

bool LuaGifAnim::IsAutoSize()
{
    return CObjPtr->IsAutoSize();
}

void LuaGifAnim::PlayGif()
{
    CObjPtr->PlayGif();
}

void LuaGifAnim::PauseGif()
{
    CObjPtr->PauseGif();
}

void LuaGifAnim::StopGif()
{
    CObjPtr->StopGif();
}

SDLUA_BEGIN_REGISTER(LuaGifAnim, GifAnim, Control)
     SDLUA_REGISTER_FUN_CPP(LuaGifAnim, SetVisible, SetVisible)
     SDLUA_REGISTER_FUN_LUA(LuaGifAnim, SetBkImage, SetBkImage)
     SDLUA_REGISTER_FUN_LUA(LuaGifAnim, GetBkImage, GetBkImage)
     SDLUA_REGISTER_FUN_CPP(LuaGifAnim, SetAutoPlay, SetAutoPlay)
     SDLUA_REGISTER_FUN_CPP(LuaGifAnim, IsAutoPlay, IsAutoPlay)
     SDLUA_REGISTER_FUN_CPP(LuaGifAnim, SetAutoSize, SetAutoSize)
     SDLUA_REGISTER_FUN_CPP(LuaGifAnim, IsAutoSize, IsAutoSize)
     SDLUA_REGISTER_FUN_CPP(LuaGifAnim, PlayGif, PlayGif)
     SDLUA_REGISTER_FUN_CPP(LuaGifAnim, PauseGif, PauseGif)
     SDLUA_REGISTER_FUN_CPP(LuaGifAnim, StopGif, StopGif)
SDLUA_END_REGISTER

SDLUA_BEGIN_UNREGISTER(LuaGifAnim, GifAnim)
SDLUA_END_UNREGISTER(GifAnim)

}

#undef CObjPtr